package com.sy.simpleegg.platform.kkb.api

import com.sy.simpleegg.platform.kkb.bean.good.ADImagesBean
import com.sy.simpleegg.platform.kkb.bean.good.GoodsCoinResponse
import com.sy.simpleegg.platform.kkb.bean.good.GoodsResponse
import com.sy.simpleegg.platform.kkb.bean.good.QRCodeBean
import com.sy.simpleegg.platform.kkb.bean.good.RechargeGoodsData
import com.sy.simpleegg.platform.kkb.network.base.BaseResult
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query
import java.util.TreeMap


interface IGoodsApi {
    /**
     * 获得门店商品
     *
     * @param token token
     * @param map   {
     * "IsExchange": true
     * }
     * @return Object
     */
    @GET("/yunyouminipos/api/v1/CoinExchange/RechargeList")
    fun getMemberRechargeList(
        @Query("appCode") appCode: String,
        @Query("timestamp") timestamp: String,
        @Query("nonce") nonce: String,
        @Query("sign") sign: String,
    ): Observable<BaseResult<RechargeGoodsData?>?>?


    /**
     * 获得门店商品
     *
     * @param token token
     * @param map   {
     * "IsExchange": true
     * }
     * @return Object
     */
    @GET("/yunyouminipos/api/v1/Goods/GoodsList")
    fun getGoodsList(
        @Query("appCode") appCode: String,
        @Query("timestamp") timestamp: String,
        @Query("nonce") nonce: String,
        @Query("sign") sign: String,
    ): Observable<BaseResult<GoodsResponse?>?>?

    /**
     * 获得门店兑币商品
     *
     * @param token token
     * @param map   {
     * "IsExchange": true
     * }
     * @return Object
     */
    @FormUrlEncoded
    @POST("api/pearl/menu.json")
    fun getPackageList(
        @FieldMap paramsMap: TreeMap<String, @JvmSuppressWildcards Any>,
    ): Observable<BaseResult<GoodsCoinResponse?>?>?

    /**
     * 查询渠道商品信息
     * @param token token
     * @param map   Code 团购码 String ，Channel EnumChannelType 是
     * @return 商品信息
     */
    @POST("/yunyouminipos/api/v1/KoubeiWriteOff/QueryInfo")
    fun queryChannelGoodsInfo(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, Any?>?,
    ): Observable<BaseResult<String?>?>?

    /**
     * 美团二维码
     * @param token token
     * @param map   Code 团购码 String ，Channel EnumChannelType 是
     */
    @POST("/yunyouminipos/api/v1/CoinExchange/GetOperationQRCode")
    fun getOperationQRCode(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, Any?>?,
    ): Observable<BaseResult<QRCodeBean?>?>?

    /**
     * 查询广告
     * @param token token
     * @param map   Code 团购码 String ，Channel EnumChannelType 是
     * @return 查询广告
     */
    @POST("/YzyIot/api/v1/Device/GetADImages")
    fun getADImages(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, Any?>?,
    ): Observable<BaseResult<ADImagesBean?>?>?
}